package nccu.webapp.controller;

import nccu.model.AccountCode;
import nccu.service.GenericManager;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/accountcodes*")
public class AccountCodeController {

    private GenericManager<AccountCode, Long> accountCodeManager;

    @Autowired
    public void setBankManager(@Qualifier("accountCodeManager") GenericManager<AccountCode, Long> accountCodeManager) {
        this.accountCodeManager = accountCodeManager;
    }

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView handleRequest()
    throws Exception {
        return new ModelAndView().addObject(accountCodeManager.getAll());
    }
}
